#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif

#include<bits/stdc++.h>

using namespace std;

#define rep(i,a,b) for(int i=(a),ed##i=(b);i<=ed##i;++i)
#define per(i,a,b) for(int i=(a),ed##i=(b);i>=ed##i;--i)
#define re(i,a) rep(i,1,a)
#define umod(x) (((x)>=mo)&&((x)-=mo))
#define dmod(x) (((x)<0)&&((x)+=mo))
#define fio(x) (freopen(x".in","r",stdin),freopen(x".out","w",stdout))
#define dbg(x) (cerr<<#x" = "<<(x)<<'\n')

using ll=long long;

const int mo=998244353;
struct Mod{
  int x;
  Mod(ll x=0):x((x%mo+mo)%mo){}

  inline Mod Pow(ll y)const{
    int x=this->x,res=1;
    while(y){
      if(y&1)res=1ll*res*x%mo;
      x=1ll*x*x%mo;
      y>>=1;
    }
    return res;
  }
};

inline Mod operator+(Mod x,Mod y){
  Mod res;
  res.x=x.x+y.x;
  umod(res.x);
  return res;
}

inline Mod operator-(Mod x,Mod y){
  Mod res;
  res.x=x.x-y.x;
  dmod(res.x);
  return res;
}

inline Mod operator*(Mod x,Mod y){
  Mod res;
  res.x=1ll*x.x*y.x%mo;
  return res;
}

inline Mod&operator+=(Mod&x,Mod y){
  x.x+=y.x,umod(x.x);
  return x;
}

inline Mod&operator-=(Mod&x,Mod y){
  x.x-=y.x,dmod(x.x);
  return x;
}

inline Mod&operator*=(Mod&x,Mod y){
  x.x=1ll*x.x*y.x%mo;
  return x;
}

inline Mod operator""_m(unsigned long long x){
  Mod res;
  res.x=x%mo;
  return res;
}

const int N=19;
ll n;
Mod Ans;
int a[N],e[N][N],A,B;
vector<pair<int,int>> vec;

inline Mod C(int x,int y){
  x%=mo;
  if(x<y)return 0;
  Mod ans=1;
  re(i,y)ans*=x-i+1;
  return ans;
}

inline bool Ck(){
  re(dif,n-1){
    bool fl=0;
    re(i,n)if(a[i]!=a[(i+dif-1)%n+1]){fl=1;break;}
    if(fl)continue;
    re(i,n){
      if(fl)break;
      rep(j,i+1,n){
        if(e[i][j]!=e[(i+dif-1)%n+1][(j+dif-1)%n+1]){fl=1;break;}
      }
    }
    if(!fl){
      //cerr<<"nopass 1 "<<dif<<'\n';
      return 0;
    }
  }
  rep(dif,0,n-1){
    bool fl=0;
    re(i,n)if(a[i]!=a[(n+dif-i)%n+1]){fl=1;break;}
    if(fl)continue;
    re(i,n){
      if(fl)break;
      rep(j,i+1,n){
        if(e[i][j]!=e[(n+dif-i)%n+1][(n+dif-j)%n+1]){fl=1;break;}
      }
    }
    if(!fl){
      //cerr<<"nopass 2 "<<dif<<'\n';
      return 0;
    }
  }
  return 1;
}

inline void Dfs2(int f,int val,int val1){
  if(f==(int)vec.size()){
    if(Ck()){
      Ans+=C(A,val1)*C(B,val);
    }
    return;
  }
  re(i,val+1){
    e[vec[f].second][vec[f].first]=e[vec[f].first][vec[f].second]=i;
    Dfs2(f+1,max(val,i),val1);
  }
}

inline void Dfs1(int f,int val){
  if(f==n+1){
    Dfs2(0,0,val);
    return;
  }
  re(i,val+1)a[f]=i,Dfs1(f+1,max(val,i));
}

signed main(){
#ifndef LOCAL
  fio("clown");
#endif
  int m;
  cin>>m;
  n=1;
  while(m--){int x;cin>>x;n*=x;}
  cin>>A>>B;
  re(i,n)rep(j,i+1,n)vec.push_back({i,j});
  //{
  //  a[1]=1,a[2]=1,a[3]=2;
  //  e[1][2]=1,e[1][3]=2,e[2][3]=1;
  //  bool fl =Ck();
  //  dbg(fl);
  //  exit(0);
  //}
  Dfs1(1,0);
  cout<<Ans.x<<'\n';
  return 0;
}
